#
# Makefile
#
#CC = arm-linux-gnueabi-gcc
CC = gcc
CFLAGS = -Wall -Wshadow -Wundef -Wmaybe-uninitialized
CFLAGS += -O3 -g3 -I./
LDFLAGS += -LSDL2/lib/x86/ -lmingw32 -lSDL2main -lSDL2
BIN = demo
VPATH = 

MAINSRC = main.c

LVGL_DIR = .
LVGL_DIR_NAME = lvgl
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/lvgl.mk

#DRIVERS
include ./lv_drivers/lv_drivers.mk

#EXAMPLE
include ./lv_examples/lv_examples.mk

# 如果需要光标，打开下面的注释
# CSRCS += mouse_cursor_icon.c

OBJEXT ?= .o

AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))

MAINOBJ = $(MAINSRC:.c=$(OBJEXT))

SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)

## MAINOBJ -> OBJFILES

all: default

%.o: %.c
	@$(CC)  $(CFLAGS) -c $< -o $@
	@echo CC $<

default: $(AOBJS) $(COBJS) $(MAINOBJ)
	$(CC) -o $(BIN) $(MAINOBJ) $(AOBJS) $(COBJS) $(LDFLAGS)
	
.PHONY:clean
clean:
	del  $(BIN).exe
	del  *.o /s

run:
	$(BIN).exe
